<template>
	<view class="content">
		<p style="margin-top: 100rpx;font-size: 1.2rem;font-weight: bold;">展示二维码</p>
		<view style="width: 90vw;margin-top: 20rpx;">
			<p style="color: #9f9f9f;">请出示电子票二维码，我们的工作人员扫码核销后即可上车游玩！</p>
		</view>
		<image :src="base64" style="margin-top: 20rpx;" mode="widthFix"></image>
		
		<view class="button_type">
			<u-button type="primary" text="刷新二维码" @click="freshQRCode"></u-button>
		</view>
	</view>
</template>

<script setup>
	import { onLoad } from '@dcloudio/uni-app'
	import { getQrCode } from '@/api/order';
	import { onMounted, ref } from 'vue';
	import { useGlobalStore } from '../../../stores/global';
	
	const store = useGlobalStore()
	const base64 = ref(-1);
	
	onLoad((options) => {
		freshQRCode();
	})
	
	async function freshQRCode(){
		const data = await getQrCode(store.orderId)
		base64.value = data.data;
		console.log(data);
		// base64.value = uni.base64ToArrayBuffer(data)
	}
	
</script>

<style>
	.content{
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	
	.button_type{
		margin-top: 100rpx;
		width: 90vw;
	}
</style>